home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / tlxinstl.zip / LASTSEG.ASM < prev    next >
Assembly Source File  |  1990-10-27  |  645b  |  40 lines

  1.  
  2.  
  3. EXTRN    ERRHAND:FAR
  4.  
  5. EXTRN    ENVIORMENT_SEG:WORD
  6. EXTRN    ERROR:BYTE
  7.  
  8. INCLUDE ZSEG.CMN
  9.  
  10. lastsegs segment para public  'code'
  11.     assume    cs:lastsegs
  12.  
  13. public    lastseg,mem_size
  14.  
  15. lastseg  proc     far
  16.  
  17. ;#------------------------ reduce memory allocation --------------------------
  18.  
  19. mem_size:
  20.     push    es
  21.     mov    ax,ENVIORMENT_SEG
  22.     mov    es,ax
  23.     mov    bx,seg zseg        ;get end of program
  24.     sub    bx,ax            ;subract start from end
  25.     mov    ax,4A00H        ;request memory size modification
  26.     int    21H            ;to release unneeded memory
  27.     jnc    mem_rel_ok
  28.  
  29.     mov    al,23
  30.     call    ERRHAND
  31.     mov    error,1
  32.  
  33. mem_rel_ok:
  34.     pop    es
  35.     ret
  36. lastseg  endp
  37. lastsegs ends
  38.  
  39.     end    lastseg
  40.